package com.zengdada.authority.config.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: 12614
 * @Contact: 1261438511@qq.com
 * @Date: 2018/11/13 18:40
 * @Description:
 */
@Component
@Slf4j
public class AuthorityEnvironmentPreparedEvent implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {


    public static List<String> profiles_active = null;


    @Override
    public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
        log.debug("ApplicationEnvironmentPreparedEvent 启动了");
        profiles_active = Arrays.asList(event.getEnvironment().getProperty("spring.profiles.active", "").split(","));
    }

}
